package com.example.danangtravel.Restaurant;

import com.example.danangtravel.R;
import com.example.danangtravel.R.drawable;
import com.example.danangtravel.R.id;
import com.example.danangtravel.R.layout;

import android.os.Bundle;
import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TabHost;
import android.widget.TextView;

public class Tbfood_activity extends TabActivity {
	public TabHost tabHost;
	public Resources res;
	public ImageButton btnhome;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tbfood_activity);
		btnhome = (ImageButton) findViewById(R.id.btnhom);
		btnhome.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				finish();
			}
		});

		setTabs();

	}

	private void setTabs() {
		addTab("Nhà Hàng", R.drawable.btnnhahang, Tbfood_threstaurant.class);
		addTab("Giải Khát", R.drawable.coffe, Tbfood_drink.class);

	}

	private void addTab(String labelId, int drawableId, Class<?> c) {
		TabHost tabHost = getTabHost();
		Intent intent = new Intent(this, c);
		TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId);

		View tabIndicator = LayoutInflater.from(this).inflate(
				R.layout.tab_indicator, getTabWidget(), false);
		TextView title = (TextView) tabIndicator.findViewById(R.id.title);
		title.setText(labelId);
		ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
		icon.setImageResource(drawableId);

		spec.setIndicator(tabIndicator);
		spec.setContent(intent);
		tabHost.addTab(spec);
	}

}